<%@ include file="include.jsp" %>
<html>
<head>
<%@include file="header.jsp" %>
<title>Configuration</title>
<script type="text/javascript"> 
  function doAjaxPost(){
		// get form values
		var xUnit = $("#xUnit").val();
		var yUnit = $("#yUnit").val();
		var spAttn = $("#spAttn").val();
		var spHealthy = $("#spHealthy").val();
		var bcAttn = $("#bcAttn").val();
		var bcHealthy = $("#bcHealthy").val();
		var rlAttn = $("#rlAttn").val();
		var rlHealthy = $("#rlHealthy").val();
		var smAttn = $("#smAttn").val();
		var smHealthy = $("#smHealthy").val();
		$.ajax(
			{
				type: "POST",
				url:  "/dashboard/admin/configure",
				data: "xUnit=" + xUnit + "&yUnit=" + yUnit + "&spAttn=" + spAttn + "&spHealthy=" + spHealthy + "&bcAttn=" + bcAttn 
						+ "&bcHealthy=" + bcHealthy + "&rlAttn=" + rlAttn + "&rlHealthy=" + rlHealthy + "&smAttn=" + smAttn
						+ "&smHealthy=" + smHealthy,
				success: function(response){
					$("#box2").html(response);
				},
				error: function(e){
					alert("Error Ajax Request: " + e);
				}
			}
		);
	}
</script>
</head>
<body>
<div id="bg">
	<div id="outer">
		<div id="header">
			<div id="logo">
				<h1>
				Database Tuning
				</h1>
			</div>
	    	<%@include file="navigation.jsp" %>
	    </div>
		<div id="main">
			<div id="left">
				<div id="box1">
				<fieldset>
				<legend>Threshold</legend>
					<dl>
						<dt><label for="x unit">X Unit: </label></dt>
						<dd><input id="xUnit" name="xUnit" type="text" value="<c:out value='${configuration.xVal}' />" /> hours</dd>
					</dl>
					<dl>
						<dt><label for="y unit">Y Unit: </label></dt>
						<dd><input id="yUnit" name="yUnit" type="text" value="<c:out value='${configuration.yVal}' />" /> minutes</dd>
					</dl>
					<dl>
						<dt><label for="share pool attn">Shared Pool Attention: </label></dt>
						<dd>&lt;=&nbsp;&nbsp;<input id="spAttn" name="spAttn" type="text" value="<c:out value='${configuration.spAttn}' />" /></dd>
					</dl>
					<dl>
						<dt><label for="share pool healthy">Shared Pool Healthy: </label></dt>
						<dd>&gt;=&nbsp;&nbsp;<input id="spHealthy" name="spHealthy" type="text" value="<c:out value='${configuration.spHealthy}' />"/></dd>
					</dl>
					<dl>
						<dt><label for="buffer cache attn">Buffer Cache Attention: </label></dt>
						<dd>&lt;=&nbsp;&nbsp;<input id="bcAttn" name="btAttn" type="text" value="<c:out value='${configuration.bcAttn}' />" /></dd>
					</dl>
					<dl>
						<dt><label for="buffer cache healthy">Buffer Cache Healthy: </label></dt>
						<dd>&gt;=&nbsp;&nbsp;<input id="bcHealthy" name="bcHealthy" type="text" value="<c:out value='${configuration.bcHealthy}' />" /></dd>
					</dl>
					<dl>
						<dt><label for="redo log attn">Redo Log Attention: </label></dt>
						<dd>&lt;=&nbsp;&nbsp;<input id="rlAttn" name="rlAttn" type="text" value="<c:out value='${configuration.rdAttn}' />" /></dd>
					</dl>
					<dl>
						<dt><label for="redo log healthy">Redo Log Healthy: </label></dt>
						<dd>&gt;=&nbsp;&nbsp;<input id="rlHealthy" name="rlHealthy" type="text" value="<c:out value='${configuration.rdHealthy}' />" /></dd>
					</dl>
					<dl>
						<dt><label for="sorting memory attn">Sorting Memory Attention: </label></dt>
						<dd>&lt;=&nbsp;&nbsp;<input id="smAttn" name="smAttn" type="text" value="<c:out value='${configuration.smAttn}' />" /></dd>
					</dl>
					<dl>
						<dt><label for="sorting memory healthy">Sorting Memory Healthy: </label></dt>
						<dd>&gt;=&nbsp;&nbsp;<input id="smHealthy" name="smHealthy" type="text" value="<c:out value='${configuration.smHealthy}' />"/></dd>
					</dl>
				</fieldset>
				<fieldset>
				<input type="button" value="Submit" onclick="doAjaxPost()" />
				</fieldset>
				</div>
			</div>
			<div id="right">
				<div id="box2"></div>
			</div>
			<br class="clear" />
		</div>
		<%@include file="footer.jsp" %>
	</div>
</div>		
</body>
</html>